#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
int main()
{
    int a = 0;
    int b = 0;
    cin >> a >> b;
    int ret = 0;
    for (int i = a; i <= b; i++)
    {
        int e = i;
        while (e)
        {
            if (e % 10 == 2)
                ret += 1;
            e /= 10;
        }
    }
    cout << ret;
    return 0;
}